<template>
  <div class="charging-protect">
    <p class="title">充电保护</p>
    <div class="data-box">
      <div class="left">
        <img src="@/assets/images/exhibition/data-icon.png" alt="" />
        <div>
          <span> 今日充电保护告警</span>
          <div>
            <span class="num1">{{ todayData.alarm }}</span
            ><span class="num2">次</span>
          </div>
        </div>
      </div>
      <div class="right">
        <img src="@/assets/images/exhibition/data-icon.png" alt="" />
        <div>
          <span> 累计充电保护告警</span>
          <div>
            <span class="num1">{{ totalData.totalAlarm }}</span
            ><span class="num2">次</span>
          </div>
        </div>
      </div>
    </div>
    <div class="bottom">
      <vue-seamless-scroll
        ref="seamlessScroll"
        :data="listData"
        class="warp"
        :class-option="classOption"
      >
        <ul class="item">
          <li v-for="(item, index) in listData" :key="index">
            <div>
              <img src="@/assets/images/exhibition/alarmicon.png" alt="" />
              <span class="des" v-text="item.des"></span>
            </div>
            <span class="stationName" v-text="item.stationName"></span>
          </li>
        </ul>
      </vue-seamless-scroll>
    </div>
  </div>
</template>
<script>
import vueSeamlessScroll from 'vue-seamless-scroll'
export default {
  name: 'ChargingProtect',
  components: {
    vueSeamlessScroll,
  },
  props: {
    data: {
      type: Array,
      required: true,
    },
    todayData: {
      type: Object,
      required: true,
    },
    totalData: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      listData: [],
      classOption: {
        step: 0.1,
        limitMoveNum: 1,
        // singleHeight: 2,
      },
    }
  },
  watch: {
    data(val) {
      this.getListData(val)
    },
  },
  methods: {
    getListData(data) {
      this.listData = data
      this.$refs.seamlessScroll.reset()
    },
  },
}
</script>
<style lang="scss" scoped>
.charging-protect {
  width: 100%;
  height: 26%;
  background: url(../../../assets/images/exhibition/rightbg3.png) center center
    no-repeat;
  background-size: 100% 100%;
  padding-left: 10px;
  position: relative;
  overflow: hidden;
  .data-box {
    height: calc(60% - 40px);
    background: url(../../../assets/images/exhibition/rightbg3b.png) center
      center no-repeat;
    background-size: 100% 100%;
    width: 90%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    & > div {
      display: flex;
      align-items: flex-start;
      img {
        margin-right: 6px;
      }
      & > div {
        & > span {
          font-size: 14px;
          color: #ffffff;
        }
        & > div {
          .num1 {
            width: 39px;
            height: 26px;
            font-size: 20px;
            font-weight: bold;
            color: #6de3fd;
          }
          .num2 {
            width: 13px;
            height: 16px;
            font-size: 12px;
            color: #ffffff;
          }
        }
      }
    }
  }
  .bottom {
    margin-top: 6px;
    width: 90%;
    height: calc(20% - 6px);
    max-height: 30px;
    background: url(../../../assets/images/exhibition/rightbg3bb.png) center
      center no-repeat;
    background-size: 100% 100%;
    padding: 6px;
    box-sizing: border-box;
    .warp {
      height: 100%;
      width: 100%;
      overflow: hidden;
      ul {
        list-style: none;
        padding: 0;
        margin: 0 auto;

        li {
          height: 30px;
          display: flex;
          justify-content: space-between;
          align-items: center;
          font-size: 12px;
          color: #ffffff;
          img {
            width: 20px;
            vertical-align: middle;
            margin-right: 4px;
          }
          span {
            vertical-align: middle;
          }
          .stationName {
            padding-right: 20px;
          }
        }
      }
    }
  }
}
@media screen and (max-width: 1440px) {
  .charging-protect {
    padding-left: 2px;
    .data-box {
      height: calc(60% - 30px);
      & > div {
        img {
          width: 14px;
        }
        & > div {
          & > span {
            font-size: 12px;
          }
          & > div {
            .num1 {
              font-size: 12px;
            }
            .num2 {
              font-size: 12px;
            }
          }
        }
      }
    }
    .bottom {
      .warp {
        ul {
          li {
            img {
              width: 12px;
              margin-right: 2px;
            }
            .stationName {
              padding-right: 2px;
            }
          }
        }
      }
    }
  }
}
</style>
